/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import AO.Course;
import dbconnector.DBDriver;
import java.sql.PreparedStatement;

/**
 *
 * @author FRIENDS
 */
public class ExamDAO
{
public static boolean save(AO.Exam exam) throws Exception
     {
      try
      {
      PreparedStatement pstmt = DBDriver.getPrepare("insert into exam values(?,?,?,?,?)");
      pstmt.setString(1, exam.getExamid());
      pstmt.setString(2, exam.getExamdate());
      pstmt.setLong(3, exam.getExamduration());
      pstmt.setString(4, exam.getCourseid());
      pstmt.setString(5, exam.getUserid());
      System.out.println("bean added not commited");
      int i=pstmt.executeUpdate();
      if(i==1)
      {  System.out.println("bean added");
          return true;
      }
    }catch(Exception e){e.printStackTrace();return false;}
      return false;
     }    
    
}
